Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: support to get all keyspaces #6793

Merged
merged 15 commits into from
Jul 13, 2023
Merged

Conversation

ystaticy
Copy link
Contributor

@ystaticy ystaticy commented Jul 13, 2023

What problem does this PR solve?

Issue Number: close #6733

What is changed and how does it work?

Check List

Tests

  • Unit test

Code changes

  • Add a pdclient func,and RPC interface.

Release note

We only use get all keyspaces and don't need to watch keyspace changes.
Removed WatchKeyspaces in pd client to avoid excessive use of goroutine.

ystaticy added 5 commits July 12, 2023 22:25
Signed-off-by: ystaticy <[email protected]>
Signed-off-by: ystaticy <[email protected]>
Signed-off-by: ystaticy <[email protected]>
Signed-off-by: ystaticy <[email protected]>
Signed-off-by: ystaticy <[email protected]>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 13, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lhy1024
  • rleungx

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. labels Jul 13, 2023
@ti-chi-bot ti-chi-bot bot added the needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. label Jul 13, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 13, 2023

Hi @ystaticy. Thanks for your PR.

I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot requested review from HunDunDM and rleungx July 13, 2023 01:46
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 13, 2023
@ystaticy ystaticy marked this pull request as ready for review July 13, 2023 01:50
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 13, 2023
Signed-off-by: ystaticy <[email protected]>
client/keyspace_client.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 13, 2023
ystaticy added 2 commits July 13, 2023 10:31
Signed-off-by: ystaticy <[email protected]>
Signed-off-by: ystaticy <[email protected]>
Signed-off-by: ystaticy <[email protected]>
@ystaticy
Copy link
Contributor Author

/test build

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 13, 2023

@ystaticy: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test build

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@@ -153,3 +155,35 @@ func (c *client) UpdateKeyspaceState(ctx context.Context, id uint32, state keysp

return resp.Keyspace, nil
}

// GetAllKeyspaces get all keyspaces metadata.
func (c *client) GetAllKeyspaces(ctx context.Context, startID uint32, limit uint32) ([]*keyspacepb.KeyspaceMeta, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If replace WatchKeyspaces with GetAllKeyspaces, will it cost too much? Do we need to use watch loop in server?

@lhy1024 lhy1024 changed the title Get all keyspaces client: support to get all keyspaces Jul 13, 2023
@lhy1024
Copy link
Contributor

lhy1024 commented Jul 13, 2023

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Jul 13, 2023
@ystaticy
Copy link
Contributor Author

/test build

@ystaticy
Copy link
Contributor Author

/retest

Signed-off-by: ystaticy <[email protected]>
@ystaticy
Copy link
Contributor Author

/test

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 13, 2023

@ystaticy: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test build
  • /test integration-copr-test

Use /test all to run the following jobs that were automatically triggered:

  • tikv/pd/ghpr_build

In response to this:

/test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ystaticy
Copy link
Contributor Author

/test all

Signed-off-by: ystaticy <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 13, 2023
@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Merging #6793 (44d4466) into master (4a4c567) will decrease coverage by 0.09%.
The diff coverage is 54.54%.

❗ Current head 44d4466 differs from pull request most recent head 5b164c6. Consider uploading reports for the commit 5b164c6 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6793      +/-   ##
==========================================
- Coverage   74.25%   74.17%   -0.09%     
==========================================
  Files         413      413              
  Lines       43399    43410      +11     
==========================================
- Hits        32225    32198      -27     
- Misses       8293     8334      +41     
+ Partials     2881     2878       -3     
Flag Coverage Δ
unittests 74.17% <54.54%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jul 13, 2023
Signed-off-by: ystaticy <[email protected]>
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 13, 2023
client/go.mod Outdated Show resolved Hide resolved
Signed-off-by: ystaticy <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 13, 2023
}

manager := s.GetKeyspaceManager()
keyspaces, err := manager.LoadRangeKeyspace(request.StartId, int(request.Limit))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How often will this interface be called, and will it cause additional performance issues if all keyspace is loaded from etcd each time? How about using watch loop?

@lhy1024
Copy link
Contributor

lhy1024 commented Jul 13, 2023

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 13, 2023

@lhy1024: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 13, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 0bd4030

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 13, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jul 13, 2023

@ystaticy: Your PR was out of date, I have automatically updated it for you.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot merged commit 42ce6a1 into tikv:master Jul 13, 2023
@ystaticy ystaticy mentioned this pull request Dec 6, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

keyspace: keyspace meta accounts for 65.28% of in-use memory of PD/API leader in dev env
3 participants